interface componentType {
  [key: string]: Component
}
const comFiles: Record<string, componentType> = import.meta.glob(
  ['/src/EleComponents/**/*.vue', '/src/components/**/*.vue'],
  {
    eager: true
  }
)
const getComponents = (): componentType => {
  let obj: componentType = {}
  // 自定义全局组件
  const com_values = Object.values(comFiles)
    .map(item => item.default)
    .filter(ite => ite.name)
  com_values.forEach(item => {
    if (item.name) {
      const name = item.name.includes('-') ? item.name.replaceAll('-', '_') : item.name
      obj[name] = item
    }
  })
  return obj
}
const components = getComponents()
export default components
